<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/index.css">
</head>
<body>
      <h1>static--登录</h1>
      <hr>
      <a href="page/show.html">显示信息</a>
      <form>
          <label for="">用户名</label>
          <input type="text" id="username">
          <label for="">密码</label>
          <input type="password" id="pwd">
          <button type="button">登录</button>
      </form>

</body>
</html>
<script src="js/jquery-3.1.0.min.js"></script>
<script>
    $(function(){

        $("button").click(()=>{
            $.ajax({
                type:"get",
                url:"user/login/"+$("#username").val()+"/"+$("#pwd").val(),
                dataType:"json",
                success:function(data){
                    console.log(data);
                    if(data.code==0){
                        alert(data.msg);
                        //把返回的token保存
                        localStorage.setItem("token",data.datas);
                        window.location.href="page/show.html";

                    }else{
                        alert(data.msg);
                    }
                }
            });
        });
    });

</script>